<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>test轮播图</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .box {
            position: relative;
            width: 490px;
            height: 170px;
            border: 1px solid orchid;
            overflow: hidden;
            margin: 50px auto;
        }

        .box>.inner {
            position: relative;
            height: 100%;
            overflow: hidden;
        }

        .box>.inner>ul {
            position: absolute;
            top: 0;
            left: 0;
            width: 500%;
            height: 100%;
            list-style: none;
        }

        .box>.inner>ul>li {
            float: left;
        }

        .box>.inner>ul>li>img {
            vertical-align: top;
        }
        .box>ol{
            position: absolute;
            bottom: 15px;
            left: 50%;
            /* background-color: gold; */
            transform: translateX(-50%);
            list-style: none;
        }
        .box>ol>li{
            float: left;
            width: 20px;
            height: 20px;
            margin-left: 5px;
            background-color: #fff;
            text-align: center;
            line-height: 20px;
            cursor: pointer;
        }
        .box>ol>li:nth-child(1){
            margin-left: 0;
        }
        .box>ol>li.selected{
            background-color: orange;
        }
    </style>
</head>
<script>
    window.onload = function () {
        var olLis = document.querySelectorAll('ol>li')
        olLis.forEach((item, index) => {
            item.onmouseover = function () {
                olLis.forEach(item => {
                    item.className = ''
                })
                this.className = 'selected'
   
            }
        })


        setInterval(() => {
            
        }, 30)
    }
</script>

<body>
    <div class="box">
        <div class="inner">
            <ul>
                <li><img src="./imgs/01.jpg" alt="图片"></li>
                <li><img src="./imgs/02.jpg" alt="图片"></li>
                <li><img src="./imgs/03.jpg" alt="图片"></li>
                <li><img src="./imgs/04.jpg" alt="图片"></li>
                <li><img src="./imgs/05.jpg" alt="图片"></li>
            </ul>
        </div>
        <ol>
            <li class="selected">1</li>
            <li>2</li>
            <li>3</li>
            <li>4</li>
            <li>5</li>
        </ol>
    </div>
</body>

</html>